package cn.mdmm.controller.system;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.mdmm.controller.BaseController;
import cn.mdmm.entity.system.SysLog;
import cn.mdmm.service.system.SysLogService;
import cn.modoumama.page.GridDataModel;
import cn.modoumama.page.Page;

@Controller
@RequestMapping(value = "/system/prg/log")
public class LogController extends BaseController {	
	@Autowired
	private SysLogService sysLogService;

	@RequestMapping(value = "init")
	public String init(HttpServletRequest request){
		return "system/log/init";
	}
	@RequestMapping(value = "list")
	@ResponseBody
	public GridDataModel list(HttpServletRequest request,HttpServletResponse response,SysLog sLog) {
		logger.debug("method: list() ");
		Page po = getPage(request,"LOG_TIME desc");
		po.getCondition().put("userName",sLog.getUserName());
		po.getCondition().put("userIp",sLog.getUserIp());
		po.getCondition().put("createTimeStart",request.getParameter("createTimeStart"));
		po.getCondition().put("createTimeEnd",request.getParameter("createTimeEnd"));
		GridDataModel gridDataModel = sysLogService.findGridDataModelByCondition(po);
		return gridDataModel;
	}
}
